*** Settings ***
Documentation    TC02-Data Cleaning AIR Project By Location
Resource    ../../Keywords/Common_Head.robot
Resource    ../../Keywords/Common/Common_kw.robot
Force Tags    P1
Metadata    Author    Nella
Metadata    ID    13560


*** Test Cases ***
TC02-Data Cleaning AIR Project By Location
    Step 1 User Goes To Basic Data Management Tender List
    Step 2 User Goes To Pricing Collaboration Pricing Project
    Step 3 Input Following Attributes
    Step 4 User Select The Row Which Project Name Is
    Step 5 User Clicks Data Cleaning Button
    Step 6 User Clicks Upload Button
    Step 7 User Clicks Add File Button And Select The File
    Step 8 User Select Location Routing
    Step 9 User Clicks Start Button
    Step 10 User Clicks Download Button
    Step 11 Check The Values Of Download File With The Original
    Step 12 Modify The Download File And User Clicks Upload Button
    Step 13 User Click Start Button
    Step 14 User Click Download Button
    Step 15 User Clicks Close Button
    Step 16 User Clicks Yes When Asking Are You Sure To Close This
    Step 17 In Pricing Project Page User Selects TenderID Contains
    Step 18 Select This Project Click On Delete Project Button
    Step 19 Ser Goes To Basic Data Management Tender List



*** Keywords ***
Step ${step} User Goes To Basic Data Management Tender List
    #************************Step 1******************************
    #  Do:
    #      User goes to Basic Data Management Tender List
    #      Click Create button
    #      Input with following attributes
    #      Tender ID some numbers such as 202408151435001 you can
    #     input with current datetime and some random number to
    #     avoid duplicate validation
    #      Tender Title some value such as Regression Test by
    #     Wendy001
    #      Customer 815 Miele
    #      Mode select all
    #      Level Global
    #      Click on Save button
    #  Expected:
    #      Created successfully with the message Tender has been
    #     added
    #************************************************************
    ${G_TENDERID}    Generate Tender ID
    ${TenderTitle}   Set Variable    Regress
    Set Test Variable     ${G_TENDERID}
    ${CurDate}    Get Current Date    result_format=%d/%m/%Y
    ${FutureDate}    Get Current Date    UTC    +10days    result_format=%d/%m/%Y
    ${validToDate}    Get Current Date    UTC    +100days    result_format=%d/%m/%Y
    ${PROJECT}    Copy Dictionary    ${PROJECT_PARAM}
    Set To Dictionary    ${PROJECT}
    ...    TENDER_ID=${G_TENDERID}    TENDER_TITLE=${TenderTitle}    CUSTOEMR_NAME=Miele    CUSTOMER_LEVEL=Global
    ...   MODE=AIR    DEADLINE_TM_DATE=${FutureDate}    VALID_FROM=${CurDate}    VALID_TO=${validToDate}    
    ...    DEPUTY=NATZHANG      TEMPLATE=${CURDIR}${/}TestData${/}AirTemplate-Location-All.xlsx
    Set Suite Variable    ${PROJECT}
    Login Space
    Create Tender    ${G_TENDERID}    Regress    815    true    true    true

Step ${step} User Goes To Pricing Collaboration Pricing Project
    #************************Step 2******************************
    #  Do:
    #      User goes to Pricing Collaboration Pricing Project
    #      User clicks Create Project button
    #  Expected:
    #      A New Project dialog should be opened successfully
    #************************************************************
    Create Project   ${PROJECT}

Step ${step} Input Following Attributes
    #************************Step 3******************************
    #  Do:
    #      Input following attributes
    #      Tender ID 202408151435001 Regression Test by Wendy001
    #      Mode Air
    #      Deadline to TM current date 10 day
    #      Rate Validity From current date
    #      Rate Validity To current date 100 day
    #      Deputies NATZHANG
    #      Description for regression
    #      Click on Save button
    #  Expected:
    #      Save successfully
    #************************************************************
    log    done

Step ${step} User Select The Row Which Project Name Is
    #************************Step 4******************************
    #  Do:
    #      User select the row which project name is
    #     202408151435001 AIR Regression Test by Wendy001
    #  Expected:
    #      The row is selected and the button of data cleaning is
    #     enabled
    #************************************************************
    Data Cleaning

Step ${step} User Clicks Data Cleaning Button
    #************************Step 5******************************
    #  Do:
    #      User clicks data cleaning button
    #  Expected:
    #      A dialogue named 202408151435001 AIR Regression Test by
    #     Wendy001 shows successfully
    #************************************************************
    log    done

Step ${step} User Clicks Upload Button
    #************************Step 6******************************
    #  Do:
    #      User clicks upload button
    #  Expected:
    #      A dialogue name Upload Template shows successfully
    #************************************************************
    log    done

Step ${step} User Clicks Add File Button And Select The File
    #************************Step 7******************************
    #  Do:
    #      User clicks add file button and select the file
    #     AirTemplate Location All xlsx from local
    #  Expected:
    #      A table shows below upload button It contains document
    #     name and date time Document name is AirTemplate Location
    #     All xlsx date time is you uploaded time like 03 10 2024
    #     17 05
    #************************************************************
    log    done

Step ${step} User Select Location Routing
    #************************Step 8******************************
    #  Do:
    #      User select location routing
    #      Select all of them
    #      User select map columns like that
    #      Origin Country country from F
    #      Destination Country country to I
    #      Origin City city from E
    #      Destination City city to H
    #      Origin State state from G
    #      Destination State state to J
    #      Schenker Service Level Schenker Service Level C
    #      Customer Service Level TSP Transport Service Provider B
    #      MD LD MD LD K
    #      Customer Lane ID Lane ID code D
    #      Origin Type Origin Type L
    #      Destination Type Des Type M
    #      Origin Postal Code Origin Postal Code N
    #      Destination Postal Code Destination Postal Code O
    #      Customer Origin Airport Customer Origin Airport H
    #      Customer Destination Airport Customer Destination
    #     Airport Q
    #      Number of Shipments Number of Shipments R
    #      Volume cbm Volume cbm S
    #      Actual weight in kg Actual weight in kg T
    #      Chargeable weight in kg Chargeable weight in kg U
    #      Commodity Description Commodity Description V
    #      Commodity Remarks Commodity Remarks W
    #      DGR Class DGR Class X
    #      DGR UN No DGR UN No Y
    #      DGR PAX CAO DGR PAX CAO Z
    #      Transit Time Door to Airport in hours Transit Time Door
    #     to Airport in hours AA
    #      Transit Time Airport to Airport in hours Transit Time
    #     Airport to Airport in hours AB
    #      Transit Time Airport to Door in hours Transit Time
    #     Airport to Door in hours AC
    #      Transit Time Door to Door in hours Transit Time Door to
    #     Door in hours AD
    #  Expected:
    #      They both should be select successfully
    #************************************************************
    log    done

Step ${step} User Clicks Start Button
    #************************Step 9******************************
    #  Do:
    #      User clicks start button
    #  Expected:
    #      In the tab of step3 validation download upload and set
    #     pass buttons appears The summary shows successful
    #************************************************************
    log    done

Step ${step} User Clicks Download Button
    #************************Step 10******************************
    #  Do:
    #      User clicks download button
    #  Expected:
    #      File download successfully
    #************************************************************
    Modify and Check Data Cleaning

Step ${step} Check The Values Of Download File With The Original
    #************************Step 11******************************
    #  Do:
    #      Check the values of download file with the original
    #     file AirTemplate Location All xlsx
    #  Expected:
    #      Compare the two files the value of the same column
    #     should be equal
    #************************************************************
    log    done

Step ${step} Modify The Download File And User Clicks Upload Button
    #************************Step 12******************************
    #  Do:
    #      Modify the download file and user clicks upload button
    #      such as update column Number of Shipments value to be
    #     100
    #  Expected:
    #      The start button appears
    #************************************************************
    log    done
 
Step ${step} User Click Start Button
    #************************Step 13******************************
    #  Do:
    #      User click start button
    #  Expected:
    #      Wait a few seconds there is a successful prompt below
    #     the buttons like that Summary Successful
    #      Please close this page and go to Generate Internal
    #     Pricing Template
    #************************************************************
    log    done

Step ${step} User Click Download Button
    #************************Step 14******************************
    #  Do:
    #      User click download button
    #  Expected:
    #      File download successfully Check the modified area the
    #     values are equal with the modified values
    #************************************************************
    log    done

Step ${step} User Clicks Close Button
    #************************Step 15******************************
    #  Do:
    #      User clicks close button
    #  Expected:
    #      A warning dialogue display and ask you Are you sure to
    #     close this page
    #************************************************************
    log    done

Step ${step} User Clicks Yes When Asking Are You Sure To Close This
    #************************Step 16******************************
    #  Do:
    #      User clicks yes when asking Are you sure to close this
    #     page
    #  Expected:
    #      The dialogue disappears
    #************************************************************
    log    done

Step ${step} In Pricing Project Page User Selects TenderID Contains
    #************************Step 17******************************
    #  Do:
    #      In Pricing Project page User selects TenderID Contains
    #     202408151435001
    #  Expected:
    #      The project could be found
    #************************************************************
    Search Project    ${G_TENDERID}

Step ${step} Select This Project Click On Delete Project Button
    #************************Step 18******************************
    #  Do:
    #      Select this project click on Delete Project button
    #      Click Yes of the pop up confirm window
    #  Expected:
    #      System displays Project has been deleted
    #************************************************************
    log    teardown

Step ${step} Ser Goes To Basic Data Management Tender List
    #************************Step 19******************************
    #  Do:
    #      ser goes to Basic Data Management Tender List
    #      Search out the tender created in step1
    #      Click on Delete button
    #      Click on Yes button in the popup dialog
    #  Expected:
    #      System displays Tender has been deleted
    #************************************************************
    log    teardown
    

